//
//  RCChoiceUpdater.m
//  Choice
//
//  Created by Rhys Cox on 29/08/2007.
//  Copyright 2007 Rhys Cox. All rights reserved.
//

#import "RCChoiceUpdater.h"
#import "AquaticPrime.h"

@implementation RCChoiceUpdater

+ (NSMutableString*)generateKey
{
	NSMutableString *key = [NSMutableString string];
	[key appendString:@"0xD0CF2DE1EA8AB896A797478019B5"];
	[key appendString:@"7D"];
	[key appendString:@"1"];
	[key appendString:@"1"];
	[key appendString:@"B747528E843CAE467754AE98A7"];
	[key appendString:@"370DB8360FE59F6C"];
	[key appendString:@"F"];
	[key appendString:@"F"];
	[key appendString:@"EECF936CE07F"];
	[key appendString:@"C3D10E07"];
	[key appendString:@"1"];
	[key appendString:@"1"];
	[key appendString:@"1C126707270E288DC212"];
	[key appendString:@"5C20F41"];
	[key appendString:@"F"];
	[key appendString:@"F"];
	[key appendString:@"F6494A827DD5F35EB8145"];
	[key appendString:@"4D37A76D5E5E12B7"];
	[key appendString:@"2"];
	[key appendString:@"2"];
	[key appendString:@"3C7FBCC54D8E"];
	[key appendString:@"845"];
	[key appendString:@"4"];
	[key appendString:@"4"];
	[key appendString:@"F69ECF236F405AA2B1122538D"];
	[key appendString:@"DB2129047423BD897A50E1347C1873"];
	[key appendString:@"0BE8D454D7022DB285"];
	// *** End Public Key *** 
	return key;
}

- (NSString*)returnLicenseName:(NSString*)licensePath
{
    AquaticPrime *licenseValidator = [AquaticPrime aquaticPrimeWithKey:[RCChoiceUpdater generateKey]];
    NSDictionary *licenseDictionary = [licenseValidator dictionaryForLicenseFile:licensePath];
	
    if (licenseDictionary == nil)
        return nil;
    else
        return [licenseDictionary objectForKey:@"Name"];
}

- (BOOL)verifyLicense:(NSString*)licensePath
{
	AquaticPrime *licenseValidator = [AquaticPrime aquaticPrimeWithKey:[RCChoiceUpdater generateKey]];
	return [licenseValidator verifyLicenseFile:licensePath];
}

@end
